<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>

    </style>
</head>
<body>
    函数式编程
    <div class="box">
        <ul id="list"></ul>
    </div>
    <script>
        function wuga(){
            var str="";
            for(var i=1;i<=10000;i++){
                str+="<li>"+i+"</li>"
            }
            list.innerHTML=str;
        }
        // wuga()
        setTimeout(function(){
            wuga()
        },1000)

        // 等上面wuga函数创建好,添加点击事件,删除创建好的li
        function wangxiaochuan() {
            // alert(document.querySelectorAll("li").length);//0
            var ul=document.querySelector('.box ul');
            ul.onclick=function(e){
                e=e||event;
                if(e.target.nodeName=="LI"){
                    e.target.remove()
                }
            }
        }
        wangxiaochuan()
    </script>

</body>
</html>